#include <bits/stdc++.h>
using namespace std;
int n, m;

int main() {
	cin >> n >> m;
	queue<int> q;
	for (int i = 1; i <= n; ++i) {
		q.push(i);
	}
	while (m--) {
		int a;
		cin >> a;
		a %= q.size();
		for (int i = 0; i < a;  ++i) {
			q.push(q.front());
			q.pop();
		}
		cout << q.front() << ' ';
		q.pop();
	}
	cout << endl;
	return 0;
}